package com.zxl.grocery.microservice.zuulgateway.server.feign;

import com.zxl.grocery.microservice.api.authority.PermissionInfo;
import com.zxl.grocery.microservice.zuulgateway.server.config.FeignConfiguration;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;


/**
 * 获取用户信息
 *
 * @author zxl
 * @create 2017-10-21 8:11
 */
//@FeignClient(value = "grocery-admin",configuration = {ZuulConfig.class})
//@RequestMapping("api")
@FeignClient(value = "grocery-admin",configuration = FeignConfiguration.class)
public interface IUserService {
  //通过登录名获取用户基本信息
//  @RequestMapping(value = "/user/username/{username}", method = RequestMethod.GET)
//  public UserInfo getUserByUsername(@PathVariable("username") String username);

  //通过登录名获取用户所拥有的权限
//  @RequestMapping(value = "/user/un/{username}/permissions", method = RequestMethod.GET)
//  public List<PermissionInfo> getPermissionByUsername(@PathVariable("username") String username);
  //获取所有权限列表
//  @RequestMapping(value = "/permissions", method = RequestMethod.GET)
//  List<PermissionInfo> getAllPermissionInfo();
  @RequestMapping(value="/api/user/un/{username}/permissions",method = RequestMethod.GET)
//  @RequestLine(value = "GET /api/user/un/{username}/permissions")
  public List<PermissionInfo> getPermissionByUsername(@PathVariable("username") String username);
  //  @RequestLine(value = "GET /api/permissions")
  @RequestMapping(value="/api/permissions",method = RequestMethod.GET)
  List<PermissionInfo> getAllPermissionInfo();
}
